package com.varian.system.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.varian.system.enums.MenuTypeEnum;
import com.varian.tool.enums.CommonStatusEnum;
import com.varian.tool.model.BaseVO;
import com.varian.tool.tree.INode;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author ben
 * @since 2024/7/3
 */
@Data
@Schema(title = "菜单视图对象")
public class SysMenuVO extends BaseVO implements INode<SysMenuVO> {
    @Schema(title = "上级菜单id")
    private Long parentId;
    @Schema(title = "菜单名称")
    private String menuName;
    @Schema(title = "菜单编码")
    private String permissionCode;
    @Schema(title = "菜单图标")
    private String menuIcon;
    @Schema(title = "菜单类型")
    @NotNull(message = "菜单类型不能为空")
    private MenuTypeEnum menuType;
    @Schema(title = "菜单路径")
    private String menuPath;
    @Schema(title = "组件路径")
    private String componentPath;
    @Schema(title = "请求方式")
    private String httpMethod;
    @Schema(title = "菜单状态")
    private CommonStatusEnum menuStatus;
    @Schema(title = "菜单权重")
    private Integer menuWeight;
    @Schema(title = "创建时间")
    private LocalDateTime createTime;
    @Schema(title = "下级菜单")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<SysMenuVO> children;

    @Override
    public Comparable<?> weight() {
        return menuWeight;
    }
}
